home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 1 / QRZ Ham Radio Callsign Database - December 1993.iso / ucsd / packet / tcpip / net / netamsrc.arc / global.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-02-12  |  2.3 KB  |  84 lines

  1. /* Global definitions used by every source file.
  2.  * Some may be compiler dependent.
  3.  */
  4. /*
  5. */
  6. /*
  7. #define MAC 1
  8. */
  9. #ifdef MAC
  10. #define defined(x) x
  11. #endif
  12. #ifdef AMIGA
  13. #define defined(x) x
  14. #endif
  15.  
  16.  
  17. /* Indexes into binmode in files.c; hook for compilers that have special
  18.  * open modes for binary files
  19.  */
  20. #define    READ_BINARY    0
  21. #define    WRITE_BINARY    1
  22. extern char *binmode[];
  23.  
  24. /* These two lines assume that your compiler's longs are 32 bits and
  25.  * shorts are 16 bits. It is already assumed that chars are 8 bits,
  26.  * but it doesn't matter if they're signed or unsigned.
  27.  */
  28. typedef long int32;        /* 32-bit signed integer */
  29. typedef unsigned short int16;    /* 16-bit unsigned integer */
  30.  
  31. /* Since not all compilers support structure assignment, the ASSIGN()
  32.  * macro is used. This controls how it's actually implemented.
  33.  */
  34. #ifdef    NOSTRUCTASSIGN    /* Version for old compilers that don't support it */
  35. #define    ASSIGN(a,b)    memcpy((char *)&(a),(char *)&(b),sizeof(b));
  36. #else            /* Version for compilers that do */
  37. #define    ASSIGN(a,b)    ((a) = (b))
  38. #endif
  39.  
  40. /* Define null object pointer in case stdio.h isn't included */
  41. #ifndef    NULL
  42. /* General purpose NULL pointer */
  43. #define    NULL (void *)0
  44. #endif
  45. #define    NULLCHAR (char *)0    /* Null character pointer */
  46. #define    NULLFP     (int (*)())0    /* Null pointer to function returning int */
  47. #define    NULLVFP     (void (*)())0    /* Null pointer to function returning void */
  48. #define    NULLFILE (FILE *)0    /* Null file pointer */
  49.  
  50. /* General purpose function macros */
  51. #define    min(x,y)    ((x)<(y)?(x):(y))    /* Lesser of two args */
  52. #define    max(x,y)    ((x)>(y)?(x):(y))    /* Greater of two args */
  53.  
  54. #ifdef    MPU8080    /* Assembler routines are available */
  55. int16 hinibble(),lonibble(),hibyte(),lobyte(),hiword(),loword();
  56.  
  57. #else
  58.  
  59. /* Extract a short from a long */
  60. #define    hiword(x)    ((int16)((x) >> 16))
  61. #define    loword(x)    ((int16)(x))
  62.  
  63. /* Extract a byte from a short */
  64. #define    hibyte(x)    (((x) >> 8) & 0xff)
  65. #define    lobyte(x)    ((x) & 0xff)
  66.  
  67. /* Extract nibbles from a byte */
  68. #define    hinibble(x)    (((x) >> 4) & 0xf)
  69. #define    lonibble(x)    ((x) & 0xf)
  70.  
  71. #endif
  72.  
  73. #ifdef    SYS5
  74. #define rindex    strrchr
  75. #define index    strchr
  76. #endif
  77.  
  78. /* Heavily used functions from the standard library */
  79. char *index(),*rindex(),*malloc(),*calloc(),*ctime(),*tmpnam();
  80.  
  81. /* Hardware I/O functions that can be replaced with macros in some compilers */
  82. unsigned char inportb();
  83. unsigned int inportw();
  84.